package com.java46.service;

import com.java46.bean.Bespeak;
import com.java46.exception.MyException;
import com.java46.mapper.BespeakMapper;
import com.java46.util.ServiceUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional
@Service
public class BespeakService {
    @Autowired
    private BespeakMapper bespeakMapper;

    public List<Bespeak> queryBespeaks() throws MyException {
        List<Bespeak> bespeaks;
        bespeaks = bespeakMapper.selectAll();

        ServiceUtil.checkListNull(bespeaks,"数据库没有数据");

        return bespeaks;
    }

}
